﻿<%@ Page Title="User Administration" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="Users.aspx.cs" Inherits="KorleBu.Users" %>

<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="sidebarcontentplaceholder" runat="server">
    <p>
        <br />
        <asp:Label ID="lblLoggedInUser" runat="server" Font-Bold="true" 
            Visible="true" />
    </p>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="maincontentplaceholder" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel" runat="server">
        <ContentTemplate>
            <div id="ebar">
                <asp:Label runat="server" ID="lblMasterError" CssClass="errorLabel" />
            </div>
            <asp:TabContainer ID="TabContainer" runat="server" AutoPostBack="true" ActiveTabIndex="1"
                TabStripPlacement="Top" OnActiveTabChanged="TabContainer_ActiveTabChanged" 
                Width="100%">
                <asp:TabPanel runat="server" HeaderText="TabPanel1" ID="TablPanel1" ScrollBars="Auto"
                    BackColor="Transparent" ForeColor="#6EA459">
                    <HeaderTemplate>
                        Create User</HeaderTemplate>
                    <ContentTemplate>
                        <asp:Label ID="lblCreateSuccess" runat="server" Font-Bold="True" ForeColor="Green" BackColor="#CFE2C6"></asp:Label>
                        <br />
                        <asp:Label ID="lblCError" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                        <br />
                        <fieldset style="padding: 10px; width: 530px;">
                            <legend>Create User</legend>
                            <fieldset style="width: 500px;">
                                <legend>User Roles</legend>
                                <asp:CheckBox ID="chkbxCAdmin" runat="server" Text="Admin" />
                                <br />
                                <asp:CheckBox ID="chkbxCGenMngr" runat="server" Text="General Manager" AutoPostBack="True"
                                    OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                <br />
                                <asp:CheckBox ID="chkbxCStoreMngr" runat="server" Text="Store Manager" AutoPostBack="True"
                                    OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                <div id="divCStore" class="divStore" runat="server">
                                    <fieldset>
                                        <legend>Store User Pertains To</legend>
                                        <asp:DropDownList ID="ddlCStore" runat="server">
                                        </asp:DropDownList>
                                    </fieldset>
                                </div>
                                <br />
                                <asp:CheckBox ID="chkbxCSubunitClrk" runat="server" Text="Subunit Clerk" AutoPostBack="True"
                                    OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                <br />
                                <asp:CheckBox ID="chkbxCCeo" runat="server" Text="CEO" AutoPostBack="True" OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                <br />
                                <asp:CheckBox ID="chkbxCProcurement" runat="server" Text="Procurement" AutoPostBack="True"
                                    OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                            </fieldset>
                            <br />
                            <fieldset style="width: 500px;">
                                <legend>Profile Info</legend>
                                <table>
                                    <tr>
                                        <th><asp:Label ID="lblCUserName" runat="server" CssClass="labels">User Name:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCUserName" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="lblCFirstName" runat="server" CssClass="labels">First Name:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCFirstName" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="lblCLastName" runat="server" CssClass="labels">Surname:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCLastName" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="lblCPassword" runat="server" CssClass="labels">Password:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCPassword" CssClass="txtboxWidth" TextMode="Password" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="Label1" runat="server" CssClass="labels">Confirm Password:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCPasswordConfirm" CssClass="txtboxWidth" TextMode="Password" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="lblCPasswordHint" runat="server" CssClass="labels">Password Hint:</asp:Label></th>
                                        <td><asp:TextBox ID="txtCPasswordHint" CssClass="txtboxWidth" runat="server" MaxLength="100"></asp:TextBox></td>
                                    </tr>
                                </table>
                            </fieldset>
                            <br />
                            <asp:Button ID="btnSave" runat="server" Text="Save" Width="50px" OnClick="btnSave_Click" />
                        </fieldset>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2" ScrollBars="Auto">
                    <HeaderTemplate>
                        Modify User</HeaderTemplate>
                    <ContentTemplate>
                        <asp:Label ID="lblModifySuccess" runat="server" Font-Bold="True" ForeColor="Green" BackColor="#CFE2C6"></asp:Label>
                        <br />
                        <asp:Label ID="lblMError" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                        <br />
                        <asp:Label ID="lblSearchBy" runat="server">Search By:</asp:Label>
                        <asp:DropDownList ID="ddlSearchBy" runat="server" OnSelectedIndexChanged="ddlSearchBy_SelectedIndexChanged"
                            AutoPostBack="True">
                            <asp:ListItem Value="0">Select Search Type...</asp:ListItem>
                            <asp:ListItem Value="1">Person's Name</asp:ListItem>
                            <asp:ListItem Value="2">User Roles</asp:ListItem>
                            <asp:ListItem Value="3">User Account Status</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="ddlRoles" runat="server" Enabled="False" OnSelectedIndexChanged="ddlRoles_SelectedIndexChanged"
                            AutoPostBack="True">
                            <asp:ListItem Value="0">Select Role...</asp:ListItem>
                            <asp:ListItem Value="1">Admin</asp:ListItem>
                            <asp:ListItem Value="2">General Manager</asp:ListItem>
                            <asp:ListItem Value="3">Store Manager</asp:ListItem>
                            <asp:ListItem Value="5">Subunit Clerk</asp:ListItem>
                            <asp:ListItem Value="6">CEO</asp:ListItem>
                            <asp:ListItem Value="8">Procurement</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="ddlStatuses" runat="server" Enabled="False" OnSelectedIndexChanged="ddlStatuses_SelectedIndexChanged"
                            AutoPostBack="True">
                            <asp:ListItem Value="0">Select Status...</asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="ddlUserList" runat="server" Enabled="False">
                            <asp:ListItem Value="0">Select Person's Name...</asp:ListItem>
                        </asp:DropDownList>
                        <asp:Button ID="btnSelectUser" runat="server" Text="Select User" Enabled="False"
                            Style="margin-left: 10px; height: 35px;" OnClick="btnSelectUser_Click" />
                        <br />
                        <br />
                        <div id="divModifyUser">
                            <fieldset style="padding: 10px;">
                                <legend>Modify User</legend>
                                <fieldset style="width: 500px;">
                                    <legend>User Roles</legend>
                                    <asp:CheckBox ID="chkbxMAdmin" Enabled="False" runat="server" Text="Admin" />
                                    <br />
                                    <asp:CheckBox ID="chkbxMGenMngr" Enabled="False" runat="server" Text="General Manager"
                                        AutoPostBack="True" OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                    <br />
                                    <asp:CheckBox ID="chkbxMStoreMngr" Enabled="False" runat="server" Text="Store Manager"
                                        AutoPostBack="True" OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                    <div id="divMStore" class="divStore" runat="server">
                                        <fieldset>
                                            <legend>Store User Pertains To</legend>
                                            <asp:DropDownList ID="ddlMStore" Enabled="False" runat="server">
                                            </asp:DropDownList>
                                        </fieldset>
                                    </div>
                                    <br />
                                    <asp:CheckBox ID="chkbxMSubunitClrk" Enabled="False" runat="server" Text="Subunit Clerk"
                                        AutoPostBack="True" OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                    <br />
                                    <asp:CheckBox ID="chkbxMCeo" Enabled="False" runat="server" Text="CEO" AutoPostBack="True"
                                        OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                    <br />
                                    <asp:CheckBox ID="chkbxMProcurement" Enabled="False" runat="server" Text="Procurement"
                                        AutoPostBack="True" OnCheckedChanged="storeCheckBoxes_OnCheckedChanged" />
                                </fieldset>
                                <br />
                                <fieldset style="width: 500px;">
                                    <legend>Profile Info</legend>
                                    <asp:HiddenField ID="hfMUserId" runat="server" />
                                    <asp:HiddenField ID="hfMOldPassword" runat="server" />
                                    <table>
                                        <tr>
                                            <th><asp:Label ID="lblMUserName" runat="server" CssClass="labels">User Name:</asp:Label></th>
                                            <td><asp:TextBox ID="txtMUserName" Enabled="False" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <th><asp:Label ID="lblMFirstName" runat="server" CssClass="labels">First Name:</asp:Label></th>
                                            <td><asp:TextBox ID="txtMFirstName" Enabled="False" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <th><asp:Label ID="lblMLastName" runat="server" CssClass="labels">Surname:</asp:Label></th>
                                            <td><asp:TextBox ID="txtMLastName" Enabled="False" CssClass="txtboxWidth" runat="server" MaxLength="20"></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <th><asp:Label ID="lblMPasswordHint" runat="server" CssClass="labels">Password Hint:</asp:Label></th>
                                            <td><asp:TextBox ID="txtMPasswordHint" Enabled="False" CssClass="txtboxWidth" runat="server" MaxLength="100"></asp:TextBox></td>
                                        </tr>
                                    </table>
                                </fieldset>
                                <br />
                                <fieldset style="width: 432px;">
                                    <legend>User Account Status</legend>
                                    <asp:DropDownList ID="ddlMStatus" Enabled="False" runat="server">
                                        <asp:ListItem>Select Status...</asp:ListItem>
                                    </asp:DropDownList>
                                </fieldset>
                                <br />
                                <asp:Button ID="btnSubmitChanges" Enabled="False" runat="server" Text="Submit Changes"
                                    CssClass="btnSubmitChanges" OnClick="btnSubmitChanges_Click" />
                                <br />
                            </fieldset>
                        </div>
                        <div id="divPswrdChange">
                            <fieldset>
                                <legend>Change Password</legend>
                                <table>
                                    <tr>
                                        <th><asp:Label ID="Label2" runat="server" CssClass="labels">New Password:</asp:Label></th>
                                        <td><asp:TextBox ID="txtMPassword" Enabled="False" TextMode="Password" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th><asp:Label ID="Label3" runat="server" CssClass="labels">Confirm Password:</asp:Label></th>
                                        <td><asp:TextBox ID="txtMPasswordConfirm" Enabled="False" TextMode="Password" runat="server" MaxLength="20"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <th></th>
                                        <td><asp:Button ID="btnSavePassword" Enabled="False" runat="server" Text="Save Password" CssClass="btnSavePassword" OnClick="btnSavePassword_Click" /></td>
                                    </tr>
                                </table>
                            </fieldset>
                        </div>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel runat="server" HeaderText="TabPanel3" ID="TabPanel3" ScrollBars="Auto"
                    BackColor="Transparent" ForeColor="#6EA459">
                    <HeaderTemplate>
                        Create Store/Subunit</HeaderTemplate>
                    <ContentTemplate>
                        <asp:Label ID="lblCStoreSuccess" runat="server" CssClass="labels" Font-Bold="True" ForeColor="Green" BackColor="#CFE2C6"></asp:Label>
                        <br />
                        <asp:Label ID="lblCStoreError" runat="server" CssClass="labels" Font-Bold="True" ForeColor="Red"></asp:Label>
                        <br />
                        <div id="divCreateStore" class="divCMStores">
                            <fieldset>
                                <legend>Store Info</legend>
                                <asp:Label ID="lblCStoreName" CssClass="labels" Font-Size="12px" Width="85px"
                                    Font-Bold="True" runat="server" Text="Store Name:" />
                                <asp:TextBox ID="txtCStoreName" runat="server" MaxLength="50" Width="280px" />
                                <br /> 
                                <asp:Label ID="lblStoreType" runat="server" Font-Bold="True" CssClass="labels" 
                                    Width="85px" Font-Size="12px" Text="Store Type:" />
                                <asp:DropDownList ID="ddlStoreTypes" runat="server">
                                    <asp:ListItem>Select Store Type...</asp:ListItem>
                                </asp:DropDownList>
                                <br />
                                <asp:Button ID="btnSaveStore" runat="server" Text="Save" Width="50px" OnClick="btnSaveStore_Click" />
                            </fieldset>
                        </div>
                        <div id="divCSubUnit" class="divCMStores">
                            <fieldset>
                                <legend>Subunit Info</legend>
                                <asp:Label ID="lblCSubUnitName" Font-Bold="True" CssClass="labels" Width="100px"
                                    Font-Size="12px" runat="server" Text="Subunit Name:" />
                                <asp:TextBox ID="txtCSubUnitName" runat="server" MaxLength="50" Width="280px" />
                                <br />
                                <asp:Button ID="btnSaveSubUnit" runat="server" Text="Save" Width="50px" OnClick="btnSaveSubUnit_Click" />
                            </fieldset>
                        </div>
                        <!--decided we don't need anything with store unit info 11/20-->
                        <!--<div id="divCStoreUnit">
                            <fieldset>
                                <legend>Store Unit Info</legend>
                                <asp:Label ID="lblCStores" Style="margin-right: 0px;" Font-Bold="True" Font-Size="12px"
                                    Width="100px" CssClass="labels" runat="server" Text="Select Store:" />
                                <asp:DropDownList ID="ddlCStores" runat="server">
                                </asp:DropDownList>
                                <br />
                                <asp:Label ID="lblCSubUnits" Font-Bold="True" CssClass="labels" Width="100px"
                                    runat="server" Font-Size="12px" Text="Select Subunit:" />
                                <asp:DropDownList ID="ddlCSubUnits" runat="server">
                                </asp:DropDownList>
                                <br />
                                <asp:Button ID="btnSaveStoreUnit" runat="server" Text="Save" Width="50px" OnClick="btnSaveStoreUnit_Click" />
                            </fieldset>
                        </div>-->
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel runat="server" HeaderText="TabPanel4" ID="TabPanel4" ScrollBars="Auto">
                    <HeaderTemplate>
                        Modify Store/Subunit</HeaderTemplate>
                    <ContentTemplate>
                        <asp:Label ID="lblMStoreSuccess" runat="server" Font-Bold="True" ForeColor="Green" BackColor="#CFE2C6"></asp:Label>
                        <br />
                        <asp:Label ID="lblMStoreError" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                        <br />
                        <div id="divModifyStore" class="divCMStores">
                            <fieldset>
                                <legend>Modify Store</legend>
                                <asp:Label ID="lblSearchStoreName" Font-Size="12px" Width="128px" 
                                    Font-Bold="True" runat="server">Select Store Name:</asp:Label>
                                <asp:DropDownList ID="ddlStoreList" runat="server">
                                    <asp:ListItem Value="0">Select Store Name...</asp:ListItem>
                                </asp:DropDownList>
                                <asp:Button ID="btnStoreSelect" Text="Select Store" Style="height: 35px; margin-left: 50px;"
                                    runat="server" OnClick="btnStoreSelect_Click" />
                                <br />
                                <br />
                                <fieldset>
                                    <legend>Store Info</legend>
                                    <asp:HiddenField ID="hfStoreID" runat="server" />
                                    <asp:Label ID="lblMStoreName" Font-Size="12px" Width="88px" Font-Bold="True" 
                                        runat="server" CssClass="labels" Text="Store Name:" />
                                    <asp:TextBox ID="txtMStoreName" runat="server" MaxLength="50" Enabled="False" 
                                        Width="280px" />
                                    <br />
                                    <asp:Label ID="lblMStoreTypes" Font-Size="12px" Width="88px" CssClass="labels"
                                        Font-Bold="True" runat="server" Text="Store Type:" />
                                    <asp:DropDownList ID="ddlMStoreTypes" runat="server" Enabled="False">
                                    </asp:DropDownList>
                                    <br />
                                    <asp:Label ID="lblMStoreStatuses" Font-size="12px" Width="88px" Font-Bold="true" 
                                        CssClass="labels" runat="server" Text="Store Status:" />
                                    <asp:DropDownList ID="ddlMStoreStatuses" runat="server" Enabled="False">
                                    </asp:DropDownList>
                                    <br />
                                    <asp:Button ID="btnSubmitStoreChanges" runat="server" Text="Submit Changes" OnClick="btnSubmitStoreChanges_Click"
                                        Enabled="False" />
                                </fieldset>
                            </fieldset>
                        </div>
                        <div id="divMSubUnit" class="divCMStores">
                            <fieldset>
                                <legend>Modify Subunit</legend>
                                <asp:Label ID="lblSearchSubUnitName"  Font-size="12px" Width="144px" Font-Bold="true" runat="server">Select Subunit Name:</asp:Label>
                                <asp:DropDownList ID="ddlSubUnitList" runat="server">
                                    <asp:ListItem Value="0">Select Sub Unit Name...</asp:ListItem>
                                </asp:DropDownList>
                                <asp:Button ID="btnSubUnitSelect" Text="Select Subunit" Style="height: 35px; margin-left: 32px;"
                                    runat="server" OnClick="btnSubUnitSelect_Click" />
                                <br />
                                <br />
                                <fieldset>
                                    <legend>Subunit Info</legend>
                                    <asp:HiddenField ID="hfSubUnitID" runat="server" />
                                    <asp:Label ID="lblMSubUnitName"  Font-size="12px" Width="103px" Font-Bold="true" runat="server" 
                                        CssClass="labels" Text="Subunit Name:" />
                                    <asp:TextBox ID="txtMSubUnitName" runat="server" MaxLength="50" Enabled="False" 
                                        Width="280px" />
                                    <br />
                                    <asp:Label ID="lblMSubUnitStatuses"  Font-size="12px" Width="103px" Font-Bold="true"
                                         CssClass="labels" runat="server" Text="Subunit Status:" />
                                    <asp:DropDownList ID="ddlMSubUnitStatuses" runat="server" Enabled="False">
                                    </asp:DropDownList>
                                    <br />
                                    <asp:Button ID="btnSubmitSubUnitChanges" runat="server" Text="Submit Changes" OnClick="btnSubmitSubUnitChanges_Click"
                                        Enabled="False" />
                                </fieldset>
                            </fieldset>
                        </div>
                        <!-- decided we didn't need subunit 11/20/12-->
                        <!--<div id="divMStoreUnit" class="divCMStores">
                            <fieldset>
                                <legend>Modify Store Unit</legend>
                                <asp:Label ID="lblMStores"  Font-size="12px" Width="88px" Font-Bold="true" 
                                    runat="server" Text="Select Store:" />
                                <asp:DropDownList ID="ddlMStores" Style="margin-right: 5px;" runat="server">
                                </asp:DropDownList>
                                <asp:Label ID="lblMSubUnits"  Font-size="12px" Width="100px" Font-Bold="true" 
                                    runat="server" Text="Select Subunit:" />
                                <asp:DropDownList ID="ddlMSubUnits" runat="server">
                                </asp:DropDownList>
                                <br />
                                <asp:Button ID="btnStoreUnitSelect" Style="margin: 6px 230px; height: 35px;" Text="Select Store Unit"
                                    runat="server" OnClick="btnStoreUnitSelect_Click" />
                                <br />
                                <fieldset>
                                    <legend>Store Unit Info</legend>
                                    <asp:HiddenField ID="hfStoreUnitID" runat="server" />
                                    <asp:Label runat="server" ID="lblStoreUnits"  Font-size="12px" Width="120px" Font-Bold="true" Text="Store Unit Status:" />
                                    <asp:DropDownList ID="ddlMStoreUnitStatuses" runat="server" Enabled="False">
                                    </asp:DropDownList>
                                    <br />
                                    <asp:Button ID="btnSubmitStoreUnitChanges" runat="server" Text="Submit Changes" OnClick="btnSubmitStoreUnitChanges_Click"
                                        Enabled="False" />
                                </fieldset>
                            </fieldset>
                        </div>-->
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
